Rank of matrix with Normal form